package com.bamboo.tool.view.component.tree;

import cn.hutool.core.util.StrUtil;
import com.bamboo.tool.entity.DescFramework;
import com.bamboo.tool.entity.NoteData;
import com.bamboo.tool.util.StringUtil;
import com.intellij.icons.AllIcons;
import lombok.Getter;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.util.List;
import java.util.Map;
import java.util.Optional;

@Getter
public class ClassNode extends BaseNode<NoteData> {


    public ClassNode(NoteData bambooClass) {
        super(bambooClass);
    }


    public @Nullable Icon getIcon(boolean selected) {
        return AllIcons.Nodes.Class;
    }

    @Override
    public String toString() {
        NoteData source = this.getSource();
        if (StrUtil.isNotBlank(source.getPersistenceInfo().getRename())) {
            return source.getPersistenceInfo().getRename() + "(" + source.getMethodCount() + ")";
        }
        return source.getName() + "(" + source.getMethodCount() + ")";
    }
}
